clear
use ${data}teacher_data

* Only have interview data for 2013 and 2014 cohors in Chicago
keep if region==1 & (CorpsYear==2013 | CorpsYear==2014)



* ---------------------- *
* Interview Day Outcomes *
* ---------------------- *


* Difference in Difference *

replace intDayAttend = 100*intDayAttend
replace intDayHire = 100*intDayHire

eststo clear

* Attend Interview Day
reg intDayAttend da hs i.CorpsYear $X, cluster(region_gl)
eststo c1
estadd scalar p = 2*ttail(1,abs(_b[da]/_se[da])): c1
qui su intDayAttend if  da==1 
estadd scalar tm = round(r(mean),.001): c1




* Hired at Interview Day
reg intDayHire da hs i.CorpsYear  $X, cluster(region_gl)
eststo c2
estadd scalar p = 2*ttail(1,abs(_b[da]/_se[da])): c2
qui su intDayHire if  da==1 
estadd scalar tm = round(r(mean),.001): c2

* Hired at Interview Day if Attended
reg intDayHire da hs i.CorpsYear  $X if intDayAttend==100, cluster(region_gl)
eststo c3
estadd scalar p = 2*ttail(1,abs(_b[da]/_se[da])): c3
qui su intDayHire if  da==1 & intDayAttend==100
estadd scalar tm = round(r(mean),.001): c3



  estout c1 c2 c3 ///
  using ${results}table2_panelB_hireRate.txt, replace ///
	keep(da) cells(b(star fmt(3) nostar)  se(par fmt(3))) ///
	collabels(,none) stat(p tm  N)  	


* Distribution of hires across rounds (conditional on being hired at interview day and observing round)
eststo clear

forv r=1/7 {
 replace hireRound`r' = 100*hireRound`r'
 reg hireRound`r' da hs i.CorpsYear $X if intDayHire==100  & hireRound>0 & hireRound<. , cluster(region_gl)
 eststo r`r'
 estadd scalar p = 2*ttail(1,abs(_b[da]/_se[da])): r`r'
 qui su hireRound`r' if intDayHire==100 & da==1 & hireRound>0 & hireRound<.
 estadd scalar tm = round(r(mean),.001): r`r'

}

estout r1 r2 r3 r4 r5 r6 r7 using ${results}table2_panelB_hireRounds.txt, append ///
	keep(da) cells(b(star fmt(3) nostar)  se(par fmt(3))) ///
	collabels(,none) stat(p tm  N)  	

	
exit
